@model BarManager.UI.Web.Models.CargoViewModel

@{ViewBag.Title = "Cargo";}

@using (Html.BeginForm("Save", "Cargo"))
{
    @Html.AntiForgeryToken()

    <fieldset class="form-horizontal">
        <legend>Cargo</legend>

        @Html.HiddenFor(model => model.Entity.Id)
        
        <div class="row">
            <div class="control-group">
                @Html.LabelFor(model => model.Entity.Descripcion, new { @class = "control-label" })
                <div class="controls">
                    @Html.EditorFor(model => model.Entity.Descripcion)
                    @Html.ValidationMessageFor(model => model.Entity.Descripcion, null, new { @class = "help-inline" })
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">Permisos</label>
                <div class="controls">
                    <div class="btn-group" data-toggle="buttons-radio">
                        @Html.CheckBoxCustom("Admin", "AdminCheck", Model.Entity.Admin)
                        @Html.HiddenFor(model => model.Entity.Admin)
                        @Html.CheckBoxCustom("Mozo", "MozoCheck", Model.Entity.Mozo)
                        @Html.HiddenFor(model => model.Entity.Mozo)
                        @Html.CheckBoxCustom("Cocina", "CocinaCheck", Model.Entity.Cocina)
                        @Html.HiddenFor(model => model.Entity.Cocina)
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="control-group">
                @Html.ValidationSummary(true)
            </div>
        </div>
        <div class="row">
            <div class="control-group">
                <div class="controls">
                    <button type="submit" class="btn btn-primary">Guardar</button>
                    @Html.ActionLink("Cancelar", "List", null, new { @class = "btn" })
                </div>
            </div>
        </div>
    </fieldset>
}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")

    <script type="text/javascript">
        $('.checkboxtoggle').click(function () {
            $("#Entity_Cocina").val(false);
            $("#Entity_Mozo").val(false);
            $("#Entity_Admin").val(false);
            $("#Entity_" + this.name.replace('Check', '')).val(!$(this).hasClass('active'));
        });
    </script>
}